package com.polaris.live.adapter.gift

import android.view.View
import com.blankj.utilcode.util.ColorUtils
import com.polaris.live.R
import com.polaris.live.common.adapter.BaseBindingAdapter
import com.polaris.live.common.adapter.VBViewHolder
import com.polaris.live.databinding.AdapterGiftDialogTitleBinding
import com.polaris.live.resp.bean.GiftSendTitleBean

/**
 * GiftTitleAdapter
 *
 * @author Created by 半仙 on 2024/4/11/011 15:44
 */
class GiftTitleAdapter : BaseBindingAdapter<AdapterGiftDialogTitleBinding, GiftSendTitleBean>() {
    private var mSelectType = -1
    override fun convert(holder: VBViewHolder<AdapterGiftDialogTitleBinding>, item: GiftSendTitleBean) {
        holder.vb.apply {
            if (mSelectType == item.type) {
                tvGiftItemTitle.setTextColor(ColorUtils.getColor(R.color.white))
                vGiftItemLine.visibility = View.VISIBLE
            } else {
                tvGiftItemTitle.setTextColor(ColorUtils.getColor(R.color.color_ffffff_30))
                vGiftItemLine.visibility = View.INVISIBLE
            }
            tvGiftItemTitle.text = item.title
        }
    }


    fun setSelectType(type: Int) {
        mSelectType = type
        notifyDataSetChanged()
    }

    fun getSelectType() = mSelectType


}